package com.cardgame.model.card;

import lombok.Getter;
import lombok.Setter;

import java.util.Map;

@Getter
@Setter // ✅ 添加 Setter 以支持 Jackson 反序列化字段
public class RoleCard extends Card implements IRoleCard {
    private Integer attack;
    private Integer health;

    // 全参构造器：用于业务创建角色卡
    public RoleCard(Integer id, String name, String imageUrl, String introduction, Integer price, Integer cost,
            Integer attack, Integer health) {
        super(id, name, imageUrl, introduction, "role", price, cost); // ⚠️ type字段用小写以匹配 JSON 中的 "type": "role"
        this.attack = attack;
        this.health = health;
    }

    // 无参构造器：用于 Jackson 反序列化
    public RoleCard() {
        super();
    }

    @Override
    public Map<String, Object> toMap() {
        Map<String, Object> map = super.toMap();
        map.put("rawAttack", attack);
        map.put("rawHp", health);
        return map;
    }
}
